/* Copyright (c) 2006, 2009, Carl Burch. License information is located in the
 * com.cburch.logisim.Main source code and at www.cburch.com/logisim/. */
 
package com.cburch.logisim.std.memory;

import java.awt.Graphics;

import com.cburch.logisim.data.Value;
import com.cburch.logisim.instance.InstancePainter;
import com.cburch.logisim.util.Strings;
import com.cburch.logisim.UItools.GraphicsUtil;

public class DFlipFlop extends AbstractFlipFlop {
    public DFlipFlop() {
        super("D Flip-Flop", Strings.getter("dFlipFlopComponent", Strings.stdSource), 1, true);
    }

    public void paintIcon(InstancePainter painter) {
        Graphics g = painter.getGraphics();
        g.drawRect(2, 2, 16, 16);
        GraphicsUtil.drawCenteredText(g, "D", 10, 8);
    }

    protected String getInputName(int index) {
        return "D";
    }

    protected Value computeValue(Value[] inputs, Value curValue) {
        return inputs[0];
    }
}
